﻿package mortal.game.view.vip
{
    import com.mui.controls.*;
    import com.mui.utils.*;
    import extend.language.*;
    import mortal.component.window.*;
    import mortal.game.manager.*;
    import mortal.game.view.vip.panel.*;
    import mortal.mvc.interfaces.*;

    public class VipModule extends BaseWindow
    {
        private var _packTabData:Array;
        private var _currentPanel:GSprite;
        private var _topPart:VipTopPart;

        public function VipModule(param1:ILayer = null)
        {
            this.init();
            super(param1);
            this.title = "VIP";
            this.layer = LayerManager.windowLayer3D;
            return;
        }// end function

        private function init() : void
        {
            setSize(898, 607);
            _titleHeight = 30;
            this._packTabData = Language.getArray(30706);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._topPart = UICompomentPool.getUICompoment(VipTopPart);
            this._topPart.move(9, 35);
            this.addChild(this._topPart);
            this.addVipLevelInfoPanel();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._topPart.dispose(param1);
            this._topPart = null;
            if (this._currentPanel)
            {
                this._currentPanel.dispose(param1);
                this._currentPanel = null;
            }
            super.disposeImpl(param1);
            return;
        }// end function

        public function addVipLevelInfoPanel() : VipLevelInfoPanel
        {
            if (this._currentPanel)
            {
                this._currentPanel.dispose();
                this._currentPanel = null;
            }
            var _loc_1:* = UICompomentPool.getUICompoment(VipLevelInfoPanel, this);
            this.addChild(_loc_1);
            this._currentPanel = _loc_1;
            return _loc_1;
        }// end function

        public function addVipComparePanel() : VipComparePanel
        {
            if (this._currentPanel)
            {
                this._currentPanel.dispose();
                this._currentPanel = null;
            }
            var _loc_1:* = UICompomentPool.getUICompoment(VipComparePanel);
            this.addChild(_loc_1);
            this._currentPanel = _loc_1;
            return _loc_1;
        }// end function

        public function vipLevelUp() : void
        {
            if (this._currentPanel is VipLevelInfoPanel)
            {
                (this._currentPanel as VipLevelInfoPanel).updeteVipLevel();
            }
            else if (this._currentPanel is VipComparePanel)
            {
                (this._currentPanel as VipComparePanel).updateSelectPos();
            }
            this._topPart.updeteVipLevel();
            return;
        }// end function

        public function rechargeUpdate() : void
        {
            this._topPart.updateReChargeAmount();
            return;
        }// end function

        public function updateRewardBtn() : void
        {
            if (this._currentPanel is VipLevelInfoPanel)
            {
                (this._currentPanel as VipLevelInfoPanel).updateRewardBtn();
            }
            return;
        }// end function

        public function flyToBackPack() : void
        {
            if (this._currentPanel is VipLevelInfoPanel)
            {
                (this._currentPanel as VipLevelInfoPanel).flyItemListToBackPack();
            }
            return;
        }// end function

        public function updateDailyBtn() : void
        {
            if (this._currentPanel is VipLevelInfoPanel)
            {
                (this._currentPanel as VipLevelInfoPanel).updateDailyBtn();
            }
            return;
        }// end function

    }
}
